﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace POS
{
    /// <summary>
    /// Interaction logic for Desserts.xaml
    /// </summary>
    public partial class Desserts : Window
    {
        double cakePrice = 4.00;
        double cheesecakePrice = 3.50;
        double chocolateSoufflePrice = 4.00;
        double cremeBruleePrice = 3.00;
        double iceCreamPrice = 2.50;
        double pancakePrice = 2.00;

        public Desserts()
        {
            InitializeComponent();
        }

        private void ButtonBackToMainMenu(object sender, RoutedEventArgs e)
        {
            MainWindow mainMenuWindow = new MainWindow();
            mainMenuWindow.Show();
            this.Close();
        }

        private void GoToOrdered(object sender, RoutedEventArgs e)
        {
            Ordered orderedMenu = new Ordered();
            orderedMenu.Show();
            this.Close();
        }
        
        private void ButtonCake(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxCakeCount.Text != "0") && (this.TextBoxCakeCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxCakeCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Cake", cakePrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }

        private void ButtonCheesecake(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxCheesecakeCount.Text != "0") && (this.TextBoxCheesecakeCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxCheesecakeCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Cheesecake", cheesecakePrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }

        private void ButtonChocolateSouffle(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxChocolateSouffleCount.Text != "0") && (this.TextBoxChocolateSouffleCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxChocolateSouffleCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Chocolate Souffle", chocolateSoufflePrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }

        private void ButtonCremeBrulee(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxCremeBruleeCount.Text != "0") && (this.TextBoxCremeBruleeCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxCremeBruleeCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Creme Brulee", cremeBruleePrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }

        private void ButtonIceCream(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxIceCreamCount.Text != "0") && (this.TextBoxIceCreamCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxIceCreamCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Ice Cream", iceCreamPrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }

        private void ButtonPancake(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxPancakeCount.Text != "0") && (this.TextBoxPancakeCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxPancakeCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Pancake", pancakePrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }

        private void RemoveCountCakeButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxCakeCount.Text == String.Empty)
            {
                this.TextBoxCakeCount.Text = "0";
            }

            if (int.Parse(this.TextBoxCakeCount.Text) > 0)
            {
                this.TextBoxCakeCount.Text = (int.Parse(this.TextBoxCakeCount.Text) - 1).ToString();
            }
        }

        private void AddCountCakeButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxCakeCount.Text == String.Empty)
            {
                this.TextBoxCakeCount.Text = "0";
            }
            this.TextBoxCakeCount.Text = (int.Parse(this.TextBoxCakeCount.Text) + 1).ToString();
        }

        private void RemoveCountCheesecakeButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxCheesecakeCount.Text == String.Empty)
            {
                this.TextBoxCheesecakeCount.Text = "0";
            }

            if (int.Parse(this.TextBoxCheesecakeCount.Text) > 0)
            {
                this.TextBoxCheesecakeCount.Text = (int.Parse(this.TextBoxCheesecakeCount.Text) - 1).ToString();
            }
        }

        private void AddCountCheesecakeButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxCheesecakeCount.Text == String.Empty)
            {
                this.TextBoxCheesecakeCount.Text = "0";
            }
            this.TextBoxCheesecakeCount.Text = (int.Parse(this.TextBoxCheesecakeCount.Text) + 1).ToString();
        }

        private void RemoveCountChocolateSouffleButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxChocolateSouffleCount.Text == String.Empty)
            {
                this.TextBoxChocolateSouffleCount.Text = "0";
            }

            if (int.Parse(this.TextBoxChocolateSouffleCount.Text) > 0)
            {
                this.TextBoxChocolateSouffleCount.Text = (int.Parse(this.TextBoxChocolateSouffleCount.Text) - 1).ToString();
            }
        }

        private void AddCountChocolateSouffleButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxChocolateSouffleCount.Text == String.Empty)
            {
                this.TextBoxChocolateSouffleCount.Text = "0";
            }
            this.TextBoxChocolateSouffleCount.Text = (int.Parse(this.TextBoxChocolateSouffleCount.Text) + 1).ToString();
        }

        private void RemoveCountCremeBruleeButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxCremeBruleeCount.Text == String.Empty)
            {
                this.TextBoxCremeBruleeCount.Text = "0";
            }

            if (int.Parse(this.TextBoxCremeBruleeCount.Text) > 0)
            {
                this.TextBoxCremeBruleeCount.Text = (int.Parse(this.TextBoxCremeBruleeCount.Text) - 1).ToString();
            }
        }

        private void AddCountCremeBruleeleButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxCremeBruleeCount.Text == String.Empty)
            {
                this.TextBoxCremeBruleeCount.Text = "0";
            }
            this.TextBoxCremeBruleeCount.Text = (int.Parse(this.TextBoxCremeBruleeCount.Text) + 1).ToString();
        }

        private void RemoveCountIceCreamButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxIceCreamCount.Text == String.Empty)
            {
                this.TextBoxIceCreamCount.Text = "0";
            }

            if (int.Parse(this.TextBoxIceCreamCount.Text) > 0)
            {
                this.TextBoxIceCreamCount.Text = (int.Parse(this.TextBoxIceCreamCount.Text) - 1).ToString();
            }
        }

        private void AddCountIceCreamButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxIceCreamCount.Text == String.Empty)
            {
                this.TextBoxIceCreamCount.Text = "0";
            }
            this.TextBoxIceCreamCount.Text = (int.Parse(this.TextBoxIceCreamCount.Text) + 1).ToString();
        }

        private void RemoveCountPancakeButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxPancakeCount.Text == String.Empty)
            {
                this.TextBoxPancakeCount.Text = "0";
            }

            if (int.Parse(this.TextBoxPancakeCount.Text) > 0)
            {
                this.TextBoxPancakeCount.Text = (int.Parse(this.TextBoxPancakeCount.Text) - 1).ToString();
            }
        }

        private void AddCountPancakeButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxPancakeCount.Text == String.Empty)
            {
                this.TextBoxPancakeCount.Text = "0";
            }
            this.TextBoxPancakeCount.Text = (int.Parse(this.TextBoxPancakeCount.Text) + 1).ToString();
        }
    }
}
